using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Resources;

namespace AutoRun
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            ttBrowse.SetToolTip(pbBrowse, "Copies portable version of ttgLib to temp directory");
            ttInstall.SetToolTip(pbInstall, "Launches installer");
        }

        private void pbBrowse_MouseEnter(object sender, EventArgs e)
        { pbBrowse.Image = global::AutoRun.Properties.Resources.logo_browse_active; }

        private void pbBrowse_MouseLeave(object sender, EventArgs e)
        { pbBrowse.Image = global::AutoRun.Properties.Resources.logo_browse; }

        private void pbBrowse_Click(object sender, EventArgs e)
        {
            String temp = Environment.GetEnvironmentVariable("TEMP");
            if (temp != null)
            {
                System.Diagnostics.Process.Start(@"xcopy", @"/Y /E Portable " + temp + @"\ttgLib\Portable\").WaitForExit();
                System.Diagnostics.Process.Start(@"explorer", temp + @"\ttgLib\Portable");
            }
            else
                System.Diagnostics.Process.Start(@"explorer", @".\Portable");
            System.Environment.Exit(0);
        }

        private void pbInstall_MouseEnter(object sender, EventArgs e)
        { pbInstall.Image = global::AutoRun.Properties.Resources.logo_install_active; }

        private void pbInstall_MouseLeave(object sender, EventArgs e)
        { pbInstall.Image = global::AutoRun.Properties.Resources.logo_install; }

        private void pbInstall_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start(@".\Install\setup.exe");
            System.Environment.Exit(0);
        }
    }
}